<%--
  Created by IntelliJ IDEA.
  User: mi
  Date: 2018/9/10
  Time: 19:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>编辑</title>
    <link rel="stylesheet" type="text/css" href="${basePath}/public/css/common.css">
    <script type="text/javascript" src="${basePath}/public/js/PCASClass.js"></script>
    <script type="text/javascript" src="${basePath}/public/js/jquery.min.js"></script>
    <script type="text/javascript">
        function button() {

            var id = $("#id").val();
            var userName = $("#userName").val();
            var province = $("#province").val();
            var city = $("#city").val();
            var area = $("#area").val();
            var address = $("#address").val();
            var phone = $("#phone").val();
            var email = $("#email").val();
            var code = $("#code").val();

            $.ajax({
                url:"${basePath}/home/UserAddress/Editor",
                type:"post",
                data:{
                    id:id,
                    userName:userName,
                    province:province,
                    city:city,
                    area:area,
                    address:address,
                    phone:phone,
                    email:email,
                    code:code
                },
                success:function (resultJson) {
                    if (resultJson.status==1){
                        window.location.href="${basePath}/home/UserAddress/index";
                    } else {
                        alert("修改失败");
                    }
                }
            })
        }

        window.onload=function(){
            //初始化省市区
            var mypcas = new PCAS("txtProvince,所属省份","txtCity,所属城市","txtArea,所属地区");
        }
    </script>
</head>
<body>
<div class="top-header">
    <div class="section">
        <div class="top-header-left f-left">
            <a href="#">LOGO</a>
        </div>
        <div class="top-header-right f-right">
            <c:choose>
                <c:when test="${empty user}">
                    <a href="${basePath}/home/vipUser/toLogin">登录</a>
                    <a href="${basePath}/home/vipUser/toRegisterVip">注册</a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                </c:when>
                <c:otherwise>
                    <a href="#">欢迎你!<W style="color: bisque;font-weight: bold; font-family: 微软雅黑; font-size: 20px;">${user.username}</W></a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                    <a href="${basePath}/home/vipUser/write">注销</a>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
</div>

<div class="section nav-header">
    <ul class="nav-menus f-left">
        <li><a href="${basePath}/home/homepage/index">首页</a></li>
        <li><a href="${basePath}/home/homepage/toProductList" >产品列表</a></li>
        <li><a href="${basePath}/home/cart" >购物车</a></li>
        <li><a href="${basePath}/home/vipUser/index" >会员中心</a></li>
        <li><a href="${basePath}/home/News/toNews">新闻资讯</a></li>
        <li><a href="${basePath}/home/pay/contact">联系我们</a></li>
    </ul>
    <div class="f-right nav-right">
        <input type="text" class="seacher-input f-left" placeholder="输入关键字">
        <a class="seacher-but  f-left" onclick="select()">搜索</a>
    </div>
</div>

<div class="section clearfix" style="margin-top: 10px;">
    <!--页面左边-->
    <div class="left-260">
        <div class="bg-wrap">
            <div class="avatar-box">
                <a class="img-box" href="${basePath}/home/vipUser/index">
                    <img src="${basePath}/public/images/${sessionScope.userImg}">
                </a>
                <h3>
                    ${sessionScope.username}
                </h3>
                <p><b>注册会员</b></p>
            </div>
            <div class="center-nav">
                <ul>
                    <li>
                        <h2>
                            <i class="iconfont icon-order"></i>
                            <span>订单管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/ShopOrder/orderList"><i class="iconfont icon-arrow-right"></i>交易订单</a></p>
                            <p><a href="${basePath}/home/UserAddress/index"><i class="iconfont icon-arrow-right"></i>收货地址</a></p>
                        </div>
                    </li>
                    <li>
                        <h2>
                            <i class="iconfont icon-amount"></i>
                            <span>余额管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/vipUser/toRecharge"><i class="iconfont icon-arrow-right"></i>账户充值
                            <p><a href="${basePath}/admin/rechargeLog/ServletRecharge"><i class="iconfont icon-arrow-right"></i>充值记录</a></p>
                        </div>
                    </li>
                    <li>
                        <h2>
                            <i class="iconfont icon-user"></i>
                            <span>账户管理</span>
                        </h2>
                        <div class="list">
                            <p><a href="${basePath}/home/vipUser/toProinfo"><i class="iconfont icon-arrow-right"></i>账户资料</a></p>
                            <p><a href="${basePath}/home/vipUser/ToUpdatePassword"><i class="iconfont icon-arrow-right"></i>修改密码</a></p>
                            <p><a href="${basePath}/home/vipUser/write"><i class="iconfont icon-arrow-right"></i>退出登录</a></p>
                        </div>
                    </li>
                </ul>
            </div>

        </div>
    </div>
    <!--/页面左边-->

    <!--页面左边-->
    <div class="right-auto">
        <div class="bg-wrap" style="min-height:765px;">
            <c:forEach items="${list}" var="m">
            <input type="hidden" value="${m.id}" id="id">
            </c:forEach>
            <div class="sub-tit " style="margin: 0px;">
                <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                <ul>
                    <li class="selected">
                        <a href="javascript:;">编辑地址</a>
                    </li>
                </ul>
            </div>

            <div class="form-box">
                <dl class="form-group">
                    <dt>收件人姓名：</dt>
                    <dd>
                        <input name="userName" id="userName" type="text" class="input" datatype="s1-50" nullmsg="请填写收件人用户名" sucmsg=" ">
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>所属地区：</dt>
                    <dd>
                        <select id="province" name="txtProvince" class="select"><option value="">所属省份</option><option value="北京市">北京市</option><option value="天津市">天津市</option><option value="河北省">河北省</option><option value="山西省">山西省</option><option value="内蒙古自治区">内蒙古自治区</option><option value="辽宁省">辽宁省</option><option value="吉林省">吉林省</option><option value="黑龙江省">黑龙江省</option><option value="上海市">上海市</option><option value="江苏省">江苏省</option><option value="浙江省">浙江省</option><option value="安徽省">安徽省</option><option value="福建省">福建省</option><option value="江西省">江西省</option><option value="山东省">山东省</option><option value="河南省">河南省</option><option value="湖北省">湖北省</option><option value="湖南省">湖南省</option><option value="广东省">广东省</option><option value="广西壮族自治区">广西壮族自治区</option><option value="海南省">海南省</option><option value="重庆市">重庆市</option><option value="四川省">四川省</option><option value="贵州省">贵州省</option><option value="云南省">云南省</option><option value="西藏自治区">西藏自治区</option><option value="陕西省">陕西省</option><option value="甘肃省">甘肃省</option><option value="青海省">青海省</option><option value="宁夏回族自治区">宁夏回族自治区</option><option value="新疆维吾尔自治区">新疆维吾尔自治区</option><option value="香港特别行政区">香港特别行政区</option><option value="澳门特别行政区">澳门特别行政区</option><option value="台湾省">台湾省</option><option value="其它">其它</option></select>
                        <select id="city" name="txtCity" class="select"><option value="">所属城市</option></select>
                        <select id="area" name="txtArea" class="select" datatype="*" nullmsg="请选择所属地区" sucmsg=" "><option value="">所属地区</option></select>
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>详细地址：</dt>
                    <dd>
                        <input name="address" id="address" type="text" class="input" maxlength="255" datatype="*0-255" nullmsg="请填写详细地址" sucmsg=" ">
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>手机号码：</dt>
                    <dd>
                        <input name="phone" id="phone" type="text" class="input" maxlength="30" datatype="m" nullmsg="请填写手机号码" sucmsg=" ">
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>电子邮箱：</dt>
                    <dd>
                        <input name="email" id="email" type="text" class="input" maxlength="30" datatype="*0-30" sucmsg=" ">
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>邮政编码：</dt>
                    <dd>
                        <input name="txtPostCode" id="code" type="text" class="input" maxlength="30" datatype="n0-10" sucmsg=" ">
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dt>验 证 码：</dt>
                    <dd>
                        <input id="txtCode" name="txtCode" type="text" class="input code" placeholder="输入验证码" datatype="s4-20" nullmsg="请输入右边显示的验证码" sucmsg=" ">
                        <a class="send" href="javascript:;" onclick="ToggleCode(this, '/tools/verify_code.ashx');return false;">
                            <img src="/tools/verify_code.ashx" width="80" height="22"> 看不清楚？
                        </a>
                        <span class="Validform_checktip"></span></dd>
                </dl>
                <dl class="form-group">
                    <dd>
                        <input id="btnSubmit" name="btnSubmit" type="submit" value="确认提交" class="submit" onclick="button()">
                    </dd>
                </dl>
            </div>
        </div>
    </div>
    <!--/页面左边-->
</div>

</body>
</html>
